package com.example.venue_reservation_service.mq;

import com.example.venue_reservation_service.service.ReservationService;
import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

import java.time.LocalTime;

@Service
public class DelayMessageConsumer {

    @Resource
    private ReservationService reservationService;

    // 处理预约检查消息
    @RabbitListener(queues = "delayed.queue")
    public void handleReservationCheck(Integer reservationId) {
        reservationService.dealReservation(reservationId);
    }

    // 处理测试消息
    @RabbitListener(queues = "delayed.queue")
    public void handleTestMessage(String message) {
        System.out.println("[" + LocalTime.now() + "] 收到延迟消息: " + message);
    }

}